package sanshi.contect.observer.v5;

import java.util.ArrayList;
import java.util.List;

public class Version05 {
    public static void main(String[] args) {

        Child child = new Child();
        child.wakeUp();

    }
}
interface Observer{
    void actionOnWakeUp();
}
class Dog implements Observer{

    @Override
    public void actionOnWakeUp() {
        System.out.println("dog wang wang wang ....");
    }
}

class Mum implements Observer{

    @Override
    public void actionOnWakeUp() {
        System.out.println("Mun   ....");
    }
}
class Dad implements Observer{

    @Override
    public void actionOnWakeUp() {
        System.out.println("Dad   ....");
    }
}

class Child{
    List<Observer> observers = new ArrayList<Observer>();
    {
        observers.add(new Dad());
        observers.add(new Mum());
        observers.add(new Dad());

    }


    public boolean cry = false;

    public boolean isCry(){
        return cry;
    }

    public void wakeUp(){
        cry = true;
        for (Observer observer : observers){
            observer.actionOnWakeUp();
        }

    }
}

